#ifndef NO_EXT
#ifndef fbext_NoBuiltinInstanciations
#define fbext_NoBuiltinInstanciations() -1
#endif
#include once "ext/xml.bi"
#endif

#ifndef __FBCONFIG_BI_
#define __FBCONFIG_BI_ -1

#define FBCONFIG_VER_MAJOR 1
#define FBCONFIG_VER_MINOR 2
#define FBCONFIG_VER_PATCH 0
#define FBCONFIG_VERSION_I RGB(FBCONFIG_VER_MAJOR, FBCONFIG_VER_MINOR, FBCONFIG_VER_PATCH)
#define FBCONFIG_VERSION "FreeBASIC Configuration Library version " & FBCONFIG_VER_MAJOR & "." & FBCONFIG_VER_MINOR & "." & FBCONFIG_VER_PATCH

#ifdef NO_EXT
namespace ext
enum bool
    false = 0
    ctrue
    true = not false
    invalid
end enum
const null as any ptr = 0
end namespace
#endif

namespace config

declare sub set_app_name( byref appn as string )
declare sub set_path( byref path as string )

declare sub load()
declare sub save()

'Basic usage
declare function get_bool( byref name_ as string, byval default as ext.bool = ext.bool.false ) as ext.bool
declare function get_string( byref name_ as string, byref default as string = "" ) as string
declare function get_integer( byref name_ as string, byval default as integer = 0 ) as integer
declare function get_double( byref name_ as string, byval default as double = 0.0 ) as double

declare sub get_bool_array( byref name_ as string, byref subname as string, array() as ext.bool )
declare sub get_integer_array( byref name_ as string, byref subname as string, array() as integer )
declare sub get_double_array( byref name_ as string, byref subname as string, array() as double )
declare sub get_string_array( byref name_ as string, byref subname as string, array() as string )

declare sub set_bool( byref name_ as string, byval v as ext.bool )
declare sub set_string( byref name_ as string, byref v as string )
declare sub set_integer( byref name_ as string, byval v as integer )
declare sub set_double( byref name_ as string, byval v as double )

declare sub set_bool_array( byref name_ as string, byref subname as string, array() as ext.bool )
declare sub set_integer_array( byref name_ as string, byref subname as string, array() as integer )
declare sub set_double_array( byref name_ as string, byref subname as string, array() as double )
declare sub set_string_array( byref name_ as string, byref subname as string, array() as string )

declare function exists( byref name_ as string ) as ext.bool
declare sub remove( byref name_ as string )

#ifndef NO_EXT
'Advanced usage
declare function get_rawxml( byref name_ as string ) as ext.xml.node ptr
#endif

end namespace

#inclib "fbconfig"
#ifdef NO_EXT
#inclib "ext-xml"
#inclib "ext-strings"
#endif

#endif
